var screenX=$(window).width();
var screenH=$(window).height();
var screenY=$(document).height();
function showKeep_div(){          
     //判断对象是不是存在
     if ($("#keep_sceen").length <= 0) {
          $("body").append('<div class="keep_sceen" id="keep_sceen"></div>');
     }  
     if ($("#onebox_sceen").length <= 0) {
          $("body").append('<div class="onebox_sceen" id="onebox_sceen"></div>');
     } 
                   
     //判断2个DIV遮掩层的宽度和高度
     var oneWidth=$("#onebox_sceen").width();
     var oneHeight=$("#onebox_sceen").height();                                          
     var twoWidth=$("#twobox_sceen").width();
     var twoHeight=$("#twobox_sceen").height();
                    
     //判断2个DIV遮掩层的lef和top值
     var oneLeft=parseInt((screenX-oneWidth)/2)+"px";
     var oneTop=parseInt((screenH-oneHeight)/2)+"px";	
     var twoLeft=parseInt((screenX-twoWidth)/2)+"px";
     var twoTop=parseInt((screenH-twoHeight)/2)+"px";	
                  
      /****第一个div遮掩层***///
     var oneBoxWidth = (screenX < 1200) ? 1200+'px' : '100%';
     $("#keep_sceen").css({
          "width":oneBoxWidth,
          "height":screenY+"px"			
     }).show();	
     
     showOnebox_sceen(oneLeft,oneTop);
     showTwobox_sceen(twoLeft,twoTop);
     
      //窗口压缩事件
     $(window).resize(function(){
          //窗口默认时定位的位置
          screenX=$(window).width();		
          screenH=$(window).height();

          oneLeft=parseInt((screenX-oneWidth)/2)+"px";
          oneTop=parseInt((screenH-oneHeight)/2)+"px";		
          twoLeft=parseInt((screenX-twoWidth)/2)+"px";
          twoTop=parseInt((screenH-twoHeight)/2)+"px";	
               
          oneBoxWidth = (screenX < 1200) ? 1200+'px' : '100%';
          //判断对象是不是显示
          if($('#keep_sceen').is(':visible')){
               $("#keep_sceen").css({
                    "width":oneBoxWidth,
                    "height":screenY+"px"			
               })	
               if($('#onebox_sceen').is(':visible')){
                    showOnebox_sceen(oneLeft,oneTop);
                    showTwobox_sceen(twoLeft,twoTop);
               }			
          }			
     });		
     
}

 /****第一个div盒子遮掩层***///
function showOnebox_sceen(oneLeft,oneTop){		
     $("#onebox_sceen").show().css({
          "position":'fixed',
          "left":oneLeft,
          "top":oneTop			
     });		
}	

  /****第二个div盒子遮掩层***///
function showTwobox_sceen(twoLeft,twoTop){		
     $("#twobox_sceen").show().css({
          "position":'fixed',
          "left":twoLeft,
          "top":twoTop			
     });		
}	
$(document).ready(function(){
     $('#setMap').click(function(){
          showKeep_div();               
          if($("#showmap").length<1){
               var str = '';
               str += '<iframe id="showmap" name="showmap" width="960" height="510" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="'+iframeMapUrl+'"></iframe>';
               $('#twobox_sceen').append(str);
          }else{
               window.frames['showmap'].setmap();
          }
     });
     //alert($('#position').val());alert($('#setMap').html());
});